Internet Subscriptions#

ict_stats <- read.csv("ict_stats.csv")
str(ict_stats)
'data.frame':	44 obs. of  4 variables:
 $ Year   : int  2011 2011 2011 2011 2012 2012 2012 2012 2013 2013 ...
 $ Quarter: chr  "Q1" "Q2" "Q3" "Q4" ...
 $ ADSL   : int  14082 14419 14474 15707 16298 17204 18166 18838 19388 23224 ...
 $ Mobile : int  189803 200198 224474 238942 263131 294548 509926 769805 958074 1098523 ...
summary(ict_stats)
      Year        Quarter               ADSL            Mobile       
 Min.   :2011   Length:44          Min.   : 14082   Min.   : 189803  
 1st Qu.:2013   Class :character   1st Qu.: 24406   1st Qu.:1231656  
 Median :2016   Mode  :character   Median : 38898   Median :1426741  
 Mean   :2016                      Mean   : 43136   Mean   :1442396  
 3rd Qu.:2019                      3rd Qu.: 55572   3rd Qu.:1915367  
 Max.   :2021                      Max.   :101915   Max.   :2496146  
ict_stats$Quarter <- as.factor(ict_stats$Quarter)
head(ict_stats)
A data.frame: 6 × 4
YearQuarterADSLMobile
<int><fct><int><int>
12011Q114082189803
22011Q214419200198
32011Q314474224474
42011Q415707238942
52012Q116298263131
62012Q217204294548
library(dplyr)
library(viridis)
library(ggplot2)
library(plotly)
library(gridExtra)
g <- ggplot(ict_stats, aes(x = Year, y = ADSL, color = Quarter)) + 
geom_line() + 
geom_point() + 
scale_y_continuous(labels = scales::unit_format(scale = 1e-6)) +
scale_color_viridis(discrete = TRUE)

ggplotly(g)

<!doctype html>

g <- ggplot(ict_stats, aes(x = Year, y = Mobile, color = Quarter)) + 
geom_line() + 
geom_point() + 
scale_y_continuous(labels = scales::unit_format(scale = 1e-6)) +
scale_color_viridis(discrete = TRUE)

ggplotly(g)

<!doctype html>

library(scales)
library(gganimate)
colors <- viridis(8, option = 'A')
#show_col(colors)
g <- ict_stats %>%
filter( Quarter == 'Q4') %>%
ggplot(aes(x = Year)) +
geom_line(aes(y = ADSL, colour='ADSL')) +
geom_line(aes(y = Mobile, colour='Mobile')) +
scale_y_continuous(labels = scales::unit_format(scale = 1e-6)) +
scale_color_manual(values = c(colors[3],colors[5]), name = 'Type') +
ggtitle('Number of Internet Subscribers') +
ylab('Subscribers') + 
theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

<!doctype html>